package com.xuecheng.manage_cms.service;


import com.xuecheng.framework.domain.cms.CmsConfig;
import com.xuecheng.manage_cms.dao.CmsConfigRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Optional;

/**
 * @author: gongfy
 * @create: 2020/7/9 16:54
 * @Params:
 * @Description:
 */
@Service
public class CmsConfigService {
    @Autowired
    private CmsConfigRepository cmsConfigRepository;
    /**
    * @Author: gongfy
    * @Param:
    * @Return:
    * @Date: 2020/7/9 16:56
    * @Description:  根据id查询配置管理信息
    **/
    public CmsConfig getConfigById(String id){
        Optional<CmsConfig> optionalCmsConfig = cmsConfigRepository.findById(id);
        if (optionalCmsConfig.isPresent()) {
            CmsConfig cmsConfig = optionalCmsConfig.get();
            return cmsConfig;
        }
        return null;
    }
}
